		var click_num = 0;
				
        function confirm_OTAConf() {
        	var frm = document.getElementById("frm");
        	var mes521 = document.getElementById("message521").value;
	        var mes527 = document.getElementById("message527").value;
	        var mes525 = document.getElementById("message525").value;
	        var mes526 = document.getElementById("message526").value;
	        var mes560 = document.getElementById("message560").value;
	        var mesF12 = document.getElementById("messageF12").value;
            
            if( frm.operator.value == "" ){
                alert(mes527);
                return ;
            }

            if ( !FFCheckBlank(frm.receiver,"",false) ) {
                alert(mes525);
                return ;
            }

            var receiver = FFValidString(frm.receiver , FFSTRING_DEF_NUMBER, 1, 20);
			
            if ( receiver == -1 || receiver == -2 ) {
		        alert(mes526);
		        return;
		    }
		
		    if(frm.receiver.value.substring(0, 2) == "00"){
		        alert(mes560);
		        return;
		    }
		
		    var result = FFCheckBlank(frm.keyword,"",false);
		   
		    if (!result) {
                alert(mesF12);
		        return;
		    }
		    
			// Call omniture's function            
            linkCode(document.getElementById("btnConfirm"));
            if ( click_num < 1 ) {
//            	var phone_model = document.frm2.phone_model.value;
//            	document.frm.phone_model.value = phone_model;
		    	frm.target = "frmid_cm";
		        frm.action = "/supporto/configurephone/wapSettingConf.do";
		        click_num++;
		        frm.submit();
		    }
        }

        function goFocus(){
            var frm = document.frm;
			frm.keyword.focus();
        }

        function goSuc(page) {
             document.location.href = page;
        }							
		
//		function showContract(){
//			var frm = document.getElementById("frm");
//			
//		    if(frm.operator.value == "0104404"){
//		    	document.getElementById("divcontract").style.display = "block";
//		    }else{
//		    	document.getElementById("divcontract").style.display = "none";
//		    }
//		}

        function showOtatype(appear){
            document.getElementById("divotatype").style.display = appear;													
        }

        function showPaytype(appear){
            document.getElementById("divpaytype").style.display = appear;							
        }
        
        function makeSelectBox(){
        	new Selectbox('operator');
        }
        
        function btn_reload(){
			RandomString.getSCaptImg(callBackReload);
        }
 
        function callBackReload(dataList) {
			var results = 0;
			var data = "";
			
			if(dataList != null){
				data += "<img id='imgCap' src='/Captcha/"+dataList+"'>";
				results = results + 1;
			}else{
				data += "<img id='imgCap' src='/Captcha/samsungmobile_2.jpg'>";
			}
			   
		   if(results != 0){
		  		document.getElementById("dwr_reload").innerHTML = data;
		  	}  
	    }
        
        function goTab(Tran){
        	if(Tran == "WAP"){
        		document.frm2.action = "/supporto/configure-phone-setting-wap.do";
        		document.frm2.submit();
        	}else if(Tran == "MMS"){
        		document.frm2.action = "/supporto/configure-phone-setting-mms.do";
        		document.frm2.submit();
        	}
        }
        
	/* Omniture Functions */
	function linkCode(obj) {
		var oOperator = document.getElementById("operator");

		if (oOperator.value) {
			var filename = "WAP Settings:" + ":" + fnGetSelectedOption(oOperator).text;

			var s = s_gi(s_account);
			s.linkTrackVars = "eVar6,events";
			s.linkTrackEvents = "event6";
			s.events = "event6";
			s.eVar6 = filename;
			s.tl(obj, "d", filename);			
		}	
	}
	
	// Return Selected Option
	function fnGetSelectedOption(oSelect) {
		var oOption;

		for (var i = 0; i < oSelect.childNodes.length; i++) {			
			oOption = oSelect.childNodes[i];

			if (oOption.tagName == "OPTION" && oOption.selected) break;			
		}

		return oOption;
	}	      
